const low = aRoom.daysTempRange.low;
const high = aRoom.daysTempRange.high;
if (!aPlan.withinRange(low, high)) {
    alerts.push("room temperature went outside range");
}

class HeatingPlan {
    withinRange(bottom, top) {
        return (bottom >= this._temperatureRange.low) && (top <= this._temperatureRange.high);
    }
}
/************************************ */
if (!aPlan.withRange(aRoom.daysTempRange.low, aRoom.daysTempRange.high)) {
    alerts.push("room temperature went outside range");
}

class HeatingPlan {
    withRange(aNumberRange) {
        return (aNumberRange.low >= this._temperatureRange.low) && (aNumberRange.high <= this._temperatureRange.high);
    }
}
/******************************************************************* */
// example2
const low2 = aRoom.daysTempRange.low;
const high2 = aRoom.daysTempRange.high;
if (!aPlan.withinRange(low, high)) {
    alerts.push("room temperature went outside range");
}
/************************************ */
const tempRange = aRoom.daysTempRange;
const low3 = tempRange.low;
const high3 = tempRange.high;
const isWithinRange = aPlan.withinRange(aPlan, tempRange);
if (!isWithinRange) {
    alerts.push("room temperature went outside range");
}

function withinRange(aPlan, tempRange) {
    const high = tempRange.high;
    const low = tempRange.low;
    const isWithinRange = aPlan.withRange(low, high);
    return isWithinRange;
}